package com.itheima.service.impl;

import com.itheima.mapper.DeptMapper;
import com.itheima.mapper.EmpMapper;
import com.itheima.pojo.Dept;
import com.itheima.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {

    @Autowired
    DeptMapper deptMapper;
    @Autowired
    EmpMapper  empMapper;
    @Override
    public List<Dept> getDepts() {
        return deptMapper.getDepts();
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void DeleteDepts(Integer id) {
        deptMapper.DeleteDepts(id);

    }

    @Override
    public void AddDept(Dept dept) {
        deptMapper.AddDept(dept);
    }
}
